const verifyEnumType = async (ctx, next) => {
  const {type} = ctx.request.body;
  console.log(type,"@@@");
  let dictId = 0;
  switch (type) {
    case "tag-type":
      dictId = 1;
      break;
    case "cate-type":
      dictId = 2;
      break;
    case "talk-type":
      dictId =3;
      break;
  }
  
  if (dictId === 0) {
    ctx.status = 400;
    ctx.body = {
      message:"参数错误",
    }
    return;
  }
  ctx.dictId = dictId;
  await next();
};


const verifyDictParams  = async (ctx,next)=>{
    const requestObj = ctx.request.body||{};
    ctx.request.body = requestObj;
    await next();
}

module.exports = {verifyEnumType,verifyDictParams}